package com.cn.aam.checaiduo.ui.homepage.command;

import com.cn.aam.checaiduo.backend.RetrofitHome;
import com.cn.aam.checaiduo.backend.observer.OnRequestListV2Listener;
import com.cn.aam.checaiduo.backend.rx.RxSchedulers;
import com.cn.aam.checaiduo.backend.CommandV2;
import com.cn.aam.checaiduo.bean.ProductItemB;
import com.cn.aam.checaiduo.bean.base.PageB;

/**
 * @author 艹羊
 * @project Checaiduo_Android
 * @date 2017/5/27 下午6:05
 * @description 众筹列表-首页列表
 */

public class CrowdFundListCommand extends CommandV2<ProductItemB> {
    private String category;//众筹产品类别，1-浮动收益，2-固定收益，默认包括全部类别
    private String brand;
    private String sequence;
    private String type;
    private String startDate;
    private String endDate;
    private String start_id;
    private String end_id;
    private String start_sequence;
    private String end_sequence;




    public CrowdFundListCommand() {
    }

    public CrowdFundListCommand(String category) {
        this.category = category;
    }

    public void clearAllData() {
        this.category = null;
        this.brand = null;
        this.sequence = null;
        this.type = null;
        this.startDate = null;
        this.endDate = null;
        this.start_id = null;
        this.end_id = null;
    }

    @Override
    public void execute(String pageNumber, String pageSize, OnRequestListV2Listener<ProductItemB> observer) {
        RetrofitHome.getInstance()
                .getInternalApi()
                .getProductList(category, brand, sequence, type, startDate, endDate, start_id, end_id, start_sequence, end_sequence, pageNumber, pageSize)
                .compose(RxSchedulers.<PageB<ProductItemB>>toMain())
                .subscribe(observer);
    }


    public void setCategory(String category) {
        this.category = category;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }


    public void setSequence(String sequence) {
        this.sequence = sequence;
    }


    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public void setStart_id(String start_id) {
        this.start_id = start_id;
    }

    public void setEnd_id(String end_id) {
        this.end_id = end_id;
    }

    public void setStart_sequence(String start_sequence) {
        this.start_sequence = start_sequence;
    }

    public void setEnd_sequence(String end_sequence) {
        this.end_sequence = end_sequence;
    }


    public String getStart_sequence() {
        return start_sequence;
    }

    public String getEnd_sequence() {
        return end_sequence;
    }
}
